package com.sym.demo.tree.tree2;

import cn.hutool.core.util.ObjectUtil;
import com.sym.demo.entity.BaseTreeEntity;
import com.sym.demo.entity.Person;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: su_yongming
 * @Date: 2021/4/9 14:42
 */
public class Tree2Test {


    private static void initTestPersons() {
        int[] treeIds = {8, 4, 5, 3, 6, 2, 7, 10, 0, 1};
        for (int i = 0; i < treePersons.size(); i++) {
            Person p = (Person) treePersons.get(i);
            p.setTreeId(treeIds[i]);
        }
    }

    public static void main(String[] args) {
        initTestPersons();
        Tree2Node<Person> tree2Node = new Tree2Node<>();

        treePersons.forEach(p -> {
            tree2Node.put(p);
        });

        System.out.println(tree2Node.get(10));


    }

    private static List<Person> treePersons = new ArrayList() {{
        add(new Person("Elsdon", "Jaycob", "Java programmer", "male", 43, 2000));
        add(new Person("Tamsen", "Brittany", "Java programmer", "female", 23, 1500));
        add(new Person("Floyd", "Donny", "Java programmer", "male", 33, 1800));
        add(new Person("Sindy", "Jonie", "Java programmer", "female", 32, 1600));
        add(new Person("Vere", "Hervey", "Java programmer", "male", 22, 1200));
        add(new Person("Maude", "Jaimie", "Java programmer", "female", 27, 1900));
        add(new Person("Shawn", "Randall", "Java programmer", "male", 30, 2300));
        add(new Person("Jayden", "Corrina", "Java programmer", "female", 35, 1700));
        add(new Person("Palmer", "Dene", "Java programmer", "male", 33, 2000));
        add(new Person("Addison", "Pam", "Java programmer", "female", 34, 1300));
    }};


}
